package com.mayuanfei.springboot11.pojo;

import com.mayuanfei.springboot11.validate.ValidGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;

/**
 * 用户请求对象
 *
 * @author 老马
 * @date 2023-06-15 13:36
 */
@Data
public class UserBO {
    @Length(min = 6,max = 12,message = "userid长度必须位于6到12之间")
    @NotBlank(groups = {ValidGroup.Update.class}, message = "用户id不能为空")
    private String userid;

    @Range(min = 1, max = 100, message = "年龄填写范围[1-100]")
    @NotNull(groups = {ValidGroup.Create.class, ValidGroup.Update.class},message = "年龄为必填项")
    private Integer age;

    @NotBlank(groups = {ValidGroup.Create.class, ValidGroup.Update.class},message = "名字为必填项")
    private String name;

    @Email(message = "请填写正确的邮箱地址")
    private String email;

    @Pattern(regexp = "男|女|未知", message = "性别请填写男、女或者未知")
    @NotBlank(groups = {ValidGroup.Create.class, ValidGroup.Update.class},message = "性别为必填项")
    private String sex;

    @NotEmpty(message = "级别不能为空")
    private String level;
}